You are here: Scripting examples > Creating a backup or snapshot of the target by inserting a task command during replication

Creating a backup or snapshot of the target by inserting a task command during replication

The following script stops the services on the source, pauses the script to allow the source time to write the remaining application data to disk, inserts a Double-Take Availability task command into the Double-Take Availability replication process, and then restarts the services.

REM     Stop the services on the source so that data changes are stopped.

net stop "Service Name 1"

net stop "Service Name 2"

net stop "Service Name 3"

net stop "Service Name 4"

 

 

REM     Pause the source (for a specified number of seconds) to allow time for

REM     the application data to be written to disk. The sleep command is available

REM     from the Windows Resource Kit.

sleep 120

 

 

REM      At this point the source application is stable (service is stopped and data

REM      is written). Now, initiate your Double-Take Availability task command, for example to

REM      trigger a snapshot or backup. The process you want to run on the target

REM      must be contained in the batch file specified in the queuetask command.

REM      That batch file must be stored on the target so that it can be executed

REM      on the target.

C:\Program Files\DoubleTake\dtcl $TheSource = "alpha"

C:\Program Files\DoubleTake\dtcl $TheTarget = "beta"

C:\Program Files\DoubleTake\dtcl $TheUserName = "administrator"

C:\Program Files\DoubleTake\dtcl $ThePassword = "password"

C:\Program Files\DoubleTake\dtcl $TheDomain = "domain.com"

C:\Program Files\DoubleTake\dtcl login $TheSource $TheUserName $ThePassword $TheDomainName

C:\Program Files\DoubleTake\dtcl login $TheTarget $TheUserName $ThePassword $TheDomainName

C:\Program Files\DoubleTake\dtcl queuetask backup to $TheTarget onexecute=Backup.bat timeout=forever

 

 

REM      Now that the task command has been inserted inline with Double-Take Availability replication, the

REM      services can be restarted. New changes to the data will fall inline behind the task

REM      command just inserted.

net start "Service Name 1"

net start "Service Name 2"

net start "Service Name 3"

net start "Service Name 4"